package com.qch;

import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.io.IOException;

/**
 * @Author qch
 * @Date 2021/2/9
 */
public class DubboPureMain3 {
    public static void main(String[] args) throws IOException {
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(ProviderConfiguration.class);
        context.start();
        //让程序不结束
        System.in.read();
    }
    @Configuration
    @EnableDubbo(scanBasePackages = "com.qch.service.impl")
    @PropertySource("classpath:/dubbo-provider3.properties")
    static  class ProviderConfiguration{
        @Bean
        public RegistryConfig registryConfig() {
            RegistryConfig riConfig=new RegistryConfig();
            riConfig.setAddress("zookeeper://192.168.142.128:2181");
            return riConfig;
        }
    }
}
